import 'package:flutter/material.dart';
import 'package:flutter_demo/pages/Tabs.dart';
import 'package:flutter_demo/routes/Routes.dart';

void main(List<String> args) {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return MaterialApp(
      //home: Tabs()
      initialRoute: '/',
      onGenerateRoute: onGenerateRoute,
    );
    // return MaterialApp(
    //   title: "我是一个标题",
    //   theme: ThemeData(primarySwatch: Colors.yellow),
    //   home: Scaffold(
    //     appBar: AppBar(
    //       title: Text("flutter demo"),
    //       elevation: 30.0,
    //     ),
    //     body: MyHomeListView(),
    //   ),
    // );
  }
}

class MyHome extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
        child: Container(
      child: Text("我是一个文本内容"),
      height: 300.0,
      width: 300.0,
      decoration: BoxDecoration(
          color: Colors.yellow,
          border: Border.all(color: Colors.blue, width: 2.0),
          borderRadius: BorderRadius.all(
              //Radius.circular(150) // 圆形
              Radius.circular(10))),
      padding: EdgeInsets.all(10),
      margin: EdgeInsets.all(10),
      alignment: Alignment.bottomLeft,
    ));
  }
}

//图片测试代码
class MyHomeImage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        width: 300,
        height: 300,
        decoration: BoxDecoration(color: Colors.yellow),
        child: Image.network(
            "https://iconfont.alicdn.com/t/3c7ca200-072c-48ba-9e41-81b727856aa3.png@500h_500w.png"),
      ),
    );
  }
}

//圆形图片处理方法一
class MyHomeImage1 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
        child: Container(
      width: 100,
      height: 100,
      decoration: BoxDecoration(
        color: Colors.yellow,
        // borderRadius: BorderRadius.all(Radius.circular(150))
        borderRadius: BorderRadius.circular(150),
        image: DecorationImage(
            image: NetworkImage(
                "https://iconfont.alicdn.com/t/3c7ca200-072c-48ba-9e41-81b727856aa3.png@500h_500w.png"),
            fit: BoxFit.cover),

        // child: Image.network(
        // "https://iconfont.alicdn.com/t/3c7ca200-072c-48ba-9e41-81b727856aa3.png@500h_500w.png"),
      ),
    ));
  }
}

//圆形图片处理的方法二
// child: Image.asset("images/1.png"),
// child: Image.network(
//           "https://iconfont.alicdn.com/t/3c7ca200-072c-48ba-9e41-81b727856aa3.png@500h_500w.png",
class MyHomeImage2 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        child: ClipOval(
            child: Image.asset(
          "images/1.png",
          width: 100,
          height: 100,
          fit: BoxFit.cover,
        )),
      ),
    );
  }
}

// listview 列表组件
class MyHomeListView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ListView(
      padding: EdgeInsets.all(10),
      children: <Widget>[
        ListTile(
          leading: Icon(Icons.access_time_filled_rounded),
          trailing: Icon(Icons.access_time_filled_rounded),
          title: Text(
            "标题",
            style: TextStyle(fontSize: 12),
          ),
          subtitle: Text("子标题"),
        ),
        ListTile(
          leading: Icon(Icons.access_time_filled_rounded),
          title: Text(
            "标题",
            style: TextStyle(fontSize: 12),
          ),
          subtitle: Text("子标题"),
        ),
        ListTile(
          leading: Icon(Icons.access_time_filled_rounded),
          title: Text(
            "标题",
            style: TextStyle(fontSize: 12),
          ),
          subtitle: Text("子标题"),
        )
      ],
    );
  }
}

// class MyHomeListView2 extends StatelessWidget{
//   @override
//   Widget build(BuildContext context) {
//     return 
//   }

// }